package com.example.HelloWorld;

import android.content.Context;
import android.content.Intent;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;

public class MsgSend extends LinearLayout {
	
	private Button button_send;
					
	public MsgSend( final Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);
		LayoutInflater.from(context).inflate(R.layout.msg_send, this, true);
		button_send = (Button) findViewById(R.id.button_send);
		button_send.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				Intent intent = new Intent();
				EditText editText = (EditText) findViewById(R.id.edit_message);
				String message = editText.getText().toString();
				intent.putExtra(HelloworldActivity.EXTRA_MESSAGE, message);			
				intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
				context.startActivity(intent);
			}
		});
	}

	public MsgSend(Context context, AttributeSet attrs) {
		this(context, attrs, 0);
	}

	public MsgSend(Context context) {
		this(context, null, 0);
	}

	public Button getButton_send() {
		return button_send;
	}

	public void setButton_send(Button button_send) {
		this.button_send = button_send;
	}
	

	/*public void sendMessage(View view) {
		// do something
		Intent intent = new Intent();
		EditText editText = (EditText) findViewById(R.id.edit_message);
		String message = editText.getText().toString();
		intent.putExtra(HelloworldActivity.EXTRA_MESSAGE, message);
	}*/

}
